#include <Arduino.h>

#include "button.h"

#include "config.h"
#include "logs.h"

static int button_pins[4] = {4, 5, 6, 7};
static int button_number = 4;

void setup()
{
  Serial.begin(115200);
  Serial.setTimeout(100);

  button_init(4, button_pins);
};

// 按键启动测试
// 10秒内需要检测到至少2次10ms宽度的黑条
void loop()
{
  int i = 0;
  button_polling();

  if (is_any_button_hit())
  {
    for (i = 0; i < button_number; i++)
    if (button_get(i))
    {
      Serial.print("BUTTON[");
      Serial.print(i, DEC);
      Serial.print("] Pressed\r\n");
    }
  }
};
